home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Dev / misc / WHDLoad_dev.lha / WHDLoad / Src / gci / wincpu.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-02-20  |  6.7 KB  |  212 lines

  1. /*****************************************************************************
  2. ;  :Module.    wincpu.c
  3. ;  :Author.    Bert Jahn
  4. ;  :Address.    Franz-Liszt-Straße 16, Rudolstadt, 07404, Germany
  5. ;  :Version.    $Id: wincpu.c 0.6 2002/02/19 21:15:21 wepl Exp wepl $
  6. ;  :History.    18.07.98 started
  7. ;        03.03.00 bubble help added to all fields
  8. ;             some cleanup
  9. ;        28.03.00 more cleanup
  10. ;  :Copyright.    All Rights Reserved
  11. ;  :Language.    C
  12. ;  :Translator.    GCC
  13. ****************************************************************************/
  14.  
  15. #include <libraries/mui.h>
  16. #include <exec/execbase.h>
  17.  
  18. #include <clib/alib_protos.h>
  19. #include <clib/muimaster_protos.h>
  20.  
  21. #include "whddump.h"
  22. #include "WHDLoadGCI.h"
  23.  
  24. /****************************************************************************/
  25.  
  26. extern APTR            app,win;
  27. extern struct whddump_header    *header;
  28. extern struct whddump_cpu    *cpu;
  29. extern const char        *StringHexAccept;
  30. extern struct Library        *MUIMasterBase;
  31.  
  32. /****************************************************************************/
  33.  
  34. APTR win_cpu = NULL;
  35.  
  36. /****************************************************************************/
  37.  
  38. void make_win_cpu(void) {
  39.     ULONG open;
  40.     APTR
  41.         regmsp=0,
  42.         regcaar=0,
  43.         regcacr=0,
  44.         regpcr=0,
  45.         regbuscr=0;
  46.     const char
  47.         *sfc="SFC:",
  48.         *dfc="DFC:",
  49.         *vbr="VBR:",
  50.         *msp="MSP:",
  51.         *caar="CAAR:",
  52.         *cacr="CACR:",
  53.         *tc="TC:",
  54.         *crp="CRP:",
  55.         *srp="SRP:",
  56.         *urp="URP:",
  57.         *mmusr="MMUSR:",
  58.         *tt0="TT0:",
  59.         *tt1="TT1:",
  60.         *dtt0="DTT0:",
  61.         *dtt1="DTT1:",
  62.         *itt0="ITT0:",
  63.         *itt1="ITT1:",
  64.         *sfc_h="Source Function Code",
  65.         *dfc_h="Destination Function Code",
  66.         *vbr_h="Vector Base Register",
  67.         *msp_h="Master Stack Pointer",
  68.         *caar_h="Cache Address Register",
  69.         *cacr_h="Cache Control Register",
  70.         *tc_h="Translation Control (MMU)",
  71.         *crp_h="CPU Root Pointer (MMU)",
  72.         *srp_h="Supervisor Root Pointer (MMU)",
  73.         *urp_h="User Root Pointer (MMU)",
  74.         *mmusr_h="MMU Status Register",
  75.         *tt0_h="Transparent Translation 0",
  76.         *tt1_h="Transparent Translation 1",
  77.         *dtt0_h="Data Transparent Translation 0",
  78.         *dtt1_h="Data Transparent Translation 1",
  79.         *itt0_h="Instruction Transparent Translation 0",
  80.         *itt1_h="Instruction Transparent Translation 1",
  81.         *t_morecpu="More CPU";
  82.  
  83.     if (win_cpu) {
  84.         get(win_cpu,MUIA_Window_Open,&open);
  85.         if (open)    set(win_cpu,MUIA_Window_Open,FALSE);
  86.         else        set(win_cpu,MUIA_Window_Open,TRUE);
  87.     } else {
  88.         switch ((header->wdh_CPU)&(AFF_68010|AFF_68020|AFF_68030|AFF_68040|AFF_68060)) {
  89.         case 0:
  90.             win_cpu = WindowObject,
  91.                 MUIA_Window_Title, t_morecpu,
  92.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  93.                 WindowContents,
  94.                     TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68000", End,
  95.                 End;
  96.             break;
  97.         case AFF_68010:
  98.             win_cpu = WindowObject,
  99.                 MUIA_Window_Title, t_morecpu,
  100.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  101.                 WindowContents, VGroup,
  102.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68010", End,
  103.                     Child, HGroup, MUIA_Group_Columns, 2,
  104.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  105.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  106.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  107.                         End,
  108.                     End,
  109.                 End;
  110.             break;
  111.         case AFF_68010|AFF_68020:
  112.             win_cpu = WindowObject,
  113.                 MUIA_Window_Title, t_morecpu,
  114.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  115.                 WindowContents, VGroup,
  116.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68020", End,
  117.                     Child, HGroup, MUIA_Group_Columns, 2,
  118.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  119.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  120.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  121.                         RegisterC(regmsp,msp,msp_h,cpu->wdc_msp,8),
  122.                         RegisterC(regcaar,caar,caar_h,cpu->wdc_caar,8),
  123.                         RegisterC(regcacr,cacr,cacr_h,cpu->wdc_cacr,8),
  124.                         End,
  125.                     End,
  126.                 End;
  127.             break;
  128.         case AFF_68010|AFF_68020|AFF_68030:
  129.             win_cpu = WindowObject,
  130.                 MUIA_Window_Title, t_morecpu,
  131.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  132.                 WindowContents, VGroup,
  133.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68030", End,
  134.                     Child, HGroup, MUIA_Group_Columns, 2,
  135.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  136.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  137.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  138.                         RegisterC(regmsp,msp,msp_h,cpu->wdc_msp,8),
  139.                         RegisterC(regcaar,caar,caar_h,cpu->wdc_caar,8),
  140.                         RegisterC(regcacr,cacr,cacr_h,cpu->wdc_cacr,8),
  141.                         Register(tc,tc_h,cpu->wdc_tc),
  142.                         Register64(crp,crp_h,cpu->wdc_crp[0],cpu->wdc_crp[1]),
  143.                         Register64(srp,srp_h,cpu->wdc_srp[0],cpu->wdc_srp[1]),
  144.                         Register(mmusr,mmusr_h,cpu->wdc_mmusr),
  145.                         Register(tt0,tt0_h,cpu->wdc_tt0),
  146.                         Register(tt1,tt1_h,cpu->wdc_tt1),
  147.                         End,
  148.                     End,
  149.                 End;
  150.             break;
  151.         case AFF_68010|AFF_68020|AFF_68030|AFF_68040:
  152.             win_cpu = WindowObject,
  153.                 MUIA_Window_Title, t_morecpu,
  154.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  155.                 WindowContents, VGroup,
  156.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68040", End,
  157.                     Child, HGroup, MUIA_Group_Columns, 2,
  158.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  159.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  160.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  161.                         RegisterC(regmsp,msp,msp_h,cpu->wdc_msp,8),
  162.                         RegisterC(regcacr,cacr,cacr_h,cpu->wdc_cacr,8),
  163.                         Register(tc,tc_h,cpu->wdc_tc),
  164.                         Register(srp,srp_h,cpu->wdc_srp[0]),
  165.                         Register(urp,urp_h,cpu->wdc_urp),
  166.                         Register(mmusr,mmusr_h,cpu->wdc_mmusr),
  167.                         Register(dtt0,dtt0_h,cpu->wdc_dtt0),
  168.                         Register(dtt1,dtt1_h,cpu->wdc_dtt1),
  169.                         Register(itt0,itt0_h,cpu->wdc_itt0),
  170.                         Register(itt1,itt1_h,cpu->wdc_itt1),
  171.                         End,
  172.                     End,
  173.                 End;
  174.             break;
  175.         case AFF_68010|AFF_68020|AFF_68030|AFF_68040|AFF_68060:
  176.             win_cpu = WindowObject,
  177.                 MUIA_Window_Title, t_morecpu,
  178.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  179.                 WindowContents, VGroup,
  180.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68060", End,
  181.                     Child, HGroup, MUIA_Group_Columns, 2,
  182.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  183.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  184.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  185.                         RegisterC(regcacr,cacr,cacr_h,cpu->wdc_cacr,8),
  186.                         RegisterC(regpcr,"PCR:","Processor Configuration Register",cpu->wdc_pcr,8),
  187.                         RegisterC(regbuscr,"BUSCR:","Bus Control Register",cpu->wdc_buscr,8),
  188.                         Register(tc,tc_h,cpu->wdc_tc),
  189.                         Register(srp,srp_h,cpu->wdc_srp[0]),
  190.                         Register(urp,urp_h,cpu->wdc_urp),
  191.                         Register(dtt0,dtt0_h,cpu->wdc_dtt0),
  192.                         Register(dtt1,dtt1_h,cpu->wdc_dtt1),
  193.                         Register(itt0,itt0_h,cpu->wdc_itt0),
  194.                         Register(itt1,itt1_h,cpu->wdc_itt1),
  195.                         End,
  196.                     End,
  197.                 End;
  198.             break;
  199.         }
  200.         if (win_cpu) {
  201.             DoMethod(app,OM_ADDMEMBER,win_cpu);
  202.             DoMethod(win_cpu,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,app,2,MUIM_Application_ReturnID,MAIN_MORECPU);
  203.             set(win_cpu,MUIA_Window_Open,TRUE);
  204.         } else {
  205.             MUI_Request(app,win,0,NULL,"Ok","Couldn't open CPU window.");
  206.         }
  207.     }
  208. }
  209.  
  210. /****************************************************************************/
  211.  
  212.